package com.augurit.wf.common.extmodel;

import com.augurit.common.base.extmodel.base.BaseTreeNode;
import com.augurit.wf.common.constant.WfConstant;

public class SummaryCountNode extends BaseTreeNode<SummaryCountNode> {

	public static final String TEMPLATE_TYPE_NAME = "templateTypeName";
	public static final String WF_TEMPLATE_NAME = "templateName";
	

	public static void loadInfo(SummaryCountNode node, String groupByProperty, String groupByValue, Long groupByCount){
		if(groupByProperty.equals(SummaryCountNode.TEMPLATE_TYPE_NAME)){
			node.setTemplateTypeName(groupByValue);
			node.setGroupByProperty(SummaryCountNode.WF_TEMPLATE_NAME);	//设置子节点的分组统计字段
			node.setText(groupByValue + getGroupByCountStr(groupByCount));
		}
		else if(groupByProperty.equals(SummaryCountNode.WF_TEMPLATE_NAME)){
			node.setLeaf(true);
			node.setText(groupByValue + getGroupByCountStr(groupByCount));
			node.setTemplateName(groupByValue);
		}
	}
	
	public static String getGroupByCountStr(Long groupByCount){
		if(groupByCount != null){
			return "&nbsp;&nbsp;（<font color='red'><B>" + groupByCount + "</B></font>&nbsp;项）";
		}
		else{
			return "&nbsp;&nbsp;（<font color='#A0A0A0'>" + groupByCount + "</font>&nbsp;项）";
		}
	}
	
	private String groupByProperty; //分组统计字段，分别为"taskType","templateTypeName","wfTemplateName"
	private String taskType;
	private String templateTypeName;
	private String templateName;

	
	public String getGroupByProperty() {
		return groupByProperty;
	}
	public void setGroupByProperty(String groupByProperty) {
		this.groupByProperty = groupByProperty;
	}
	public String getTaskType() {
		return taskType;
	}
	public void setTaskType(String taskType) {
		this.taskType = taskType;
	}

	public String getTemplateTypeName() {
		return templateTypeName;
	}

	public void setTemplateTypeName(String templateTypeName) {
		this.templateTypeName = templateTypeName;
	}

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}
}
